Skip to content

[OPDATA-4855] Added TokenAccount Support for solana-functions#4350

Merged
chray-zhang merged 6 commits intomainfrom
cz/add-token-layout
Jan 21, 2026
Merged

[OPDATA-4855] Added TokenAccount Support for solana-functions#4350
chray-zhang merged 6 commits intomainfrom
cz/add-token-layout

Conversation

@chray-zhang
Copy link
Collaborator

@chray-zhang chray-zhang commented Dec 1, 2025

Closes OPDATA-4855

Description

Originally the solana-functions buffer-layout endpoint only supported MintLayout and SanctumPoolStateLayout. It did not support Token account programs. This change is to add support to deserialize and support Token Accounts

Changes

Implemented: https://solana-labs.github.io/solana-program-library/token/js/variables/AccountLayout.html

Steps to Test

Token Account:

chrayzhang@MB-C3H04RT9WT ~ % curl -X POST http://localhost:8080 \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "endpoint": "buffer-layout",
      "field": "amount",
      "stateAccountAddress": "FvkbfMm98jefJWrqkvXvsSZ9RFaRBae8k6c1jaYA5vY3"
    }
  }' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   497  100   336  100   161    271    130  0:00:01  0:00:01 --:--:--   401
{
  "data": {
    "result": "34228815152"
  },
  "statusCode": 200,
  "result": "34228815152",
  "timestamps": {
    "providerDataRequestedUnixMs": 1764628385812,
    "providerDataReceivedUnixMs": 1764628386096
  },
  "meta": {
    "adapterName": "SOLANA_FUNCTIONS",
    "metrics": {
      "feedId": "{\"stateAccountAddress\":\"fvkbfmm98jefjwrqkvxvssz9rfarbae8k6c1jaya5vy3\",\"field\":\"amount\"}"
    }
  }
}

Mint account:

chrayzhang@MB-C3H04RT9WT ~ % curl -X POST http://localhost:8080 \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "endpoint": "buffer-layout",
      "field": "supply",
      "stateAccountAddress": "3b8X44fLF9ooXaUm3hhSgjpmVs6rZZ3pPoGnGahc3Uu7"
    }
  }' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   497  100   336  100   161   1635    783 --:--:-- --:--:-- --:--:--  2424
{
  "data": {
    "result": "34156329357"
  },
  "statusCode": 200,
  "result": "34156329357",
  "timestamps": {
    "providerDataRequestedUnixMs": 1764628429970,
    "providerDataReceivedUnixMs": 1764628430044
  },
  "meta": {
    "adapterName": "SOLANA_FUNCTIONS",
    "metrics": {
      "feedId": "{\"stateAccountAddress\":\"3b8x44flf9ooxaum3hhsgjpmvs6rzz3ppogngahc3uu7\",\"field\":\"supply\"}"
    }
  }
}

Quality Assurance

  • [ x] If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant infra-k8s configuration file.
  • [ x] If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant adapter-secrets configuration file.
  • [ x] If a new adapter was made, or a new endpoint was added, update the test-payload.json file with relevant requests.
  • [ x] The branch naming follows git flow (feature/x, chore/x, release/x, hotfix/x, fix/x) or is created from Jira.
  • [ x] This is related to a maximum of one Jira story or GitHub issue.
  • [ x] Types are safe (avoid TypeScript/TSLint features like any and disable, instead use more specific types).
  • [ x] All code changes have 100% unit and integration test coverage. If testing is not applicable or too difficult to justify doing, the reasoning should be documented explicitly in the PR.

@changeset-bot
Copy link

changeset-bot bot commented Dec 1, 2025

🦋 Changeset detected

Latest commit: 0639d94

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chainlink/solana-functions-adapter Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chray-zhang chray-zhang changed the title Added TokenAccount Support [OPDATA-4855] Added TokenAccount Support for solana-functions Dec 1, 2025
@chray-zhang chray-zhang requested a review from dskloetc December 1, 2025 23:00
@chray-zhang chray-zhang marked this pull request as ready for review December 1, 2025 23:01
@chray-zhang chray-zhang enabled auto-merge (squash) December 2, 2025 05:43
@chray-zhang chray-zhang merged commit 4f17e00 into main Jan 21, 2026
15 of 16 checks passed
@chray-zhang chray-zhang deleted the cz/add-token-layout branch January 21, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants